package com.weather.business.service.impl;

import com.weather.business.domain.NmCrops;
import com.weather.business.mapper.NmCropsMapper;
import com.weather.business.service.INmCropsService;
import com.weather.common.annotation.DataScope;
import com.weather.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 养殖日期Service业务层处理
 *
 * @author ruoyi
 * @date 2024-03-16
 */
@Service
public class NmCropsServiceImpl implements INmCropsService
{
    @Autowired
    private NmCropsMapper nmCropsMapper;

    /**
     * 查询养殖日期
     *
     * @param id 养殖日期主键
     * @return 养殖日期
     */
    @Override
    public NmCrops selectNmCropsById(Long id)
    {
        return nmCropsMapper.selectNmCropsById(id);
    }

    /**
     * 查询养殖日期列表
     *
     * @param nmCrops 养殖日期
     * @return 养殖日期
     */
    @Override
    @DataScope(userAlias = "u")
    public List<NmCrops> selectNmCropsList(NmCrops nmCrops)
    {
        return nmCropsMapper.selectNmCropsList(nmCrops);
    }

    /**
     * 新增养殖日期
     *
     * @param nmCrops 养殖日期
     * @return 结果
     */
    @Override
    public int insertNmCrops(NmCrops nmCrops)
    {
        nmCrops.setCreateTime(DateUtils.getNowDate());
        return nmCropsMapper.insertNmCrops(nmCrops);
    }

    /**
     * 修改养殖日期
     *
     * @param nmCrops 养殖日期
     * @return 结果
     */
    @Override
    public int updateNmCrops(NmCrops nmCrops)
    {
        nmCrops.setUpdateTime(DateUtils.getNowDate());
        return nmCropsMapper.updateNmCrops(nmCrops);
    }

    /**
     * 批量删除养殖日期
     *
     * @param ids 需要删除的养殖日期主键
     * @return 结果
     */
    @Override
    public int deleteNmCropsByIds(Long[] ids)
    {
        return nmCropsMapper.deleteNmCropsByIds(ids);
    }

    /**
     * 删除养殖日期信息
     *
     * @param id 养殖日期主键
     * @return 结果
     */
    @Override
    public int deleteNmCropsById(Long id)
    {
        return nmCropsMapper.deleteNmCropsById(id);
    }
}
